<!DOCTYPE HTML>
<html>
<head>
    <title>登录也</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="keywords" content=""/>
    <script type="application/x-javascript"> addEventListener("load", function () {
            setTimeout(hideURLbar, 0);
        }, false);

        function hideURLbar() {
            window.scrollTo(0, 1);
        }
    </script>

    <!-- Bootstrap Core CSS -->
    <link href="static/css/bootstrap.css" rel='stylesheet' type='text/css'/>

    <!-- Custom CSS -->
    <link href="static/css/style.css" rel='stylesheet' type='text/css'/>

    <!-- font-awesome icons CSS-->
    <link href="static/css/font-awesome.css" rel="stylesheet">
    <!-- //font-awesome icons CSS-->

    <!-- side nav css file -->
    <link href='static/css/SidebarNav.min.css' media='all' rel='stylesheet' type='text/css'/>
    <!-- side nav css file -->

    <!-- js-->
    <script src="static/js/jquery-1.11.1.min.js"></script>
    <script src="static/js/modernizr.custom.js"></script>


    <!-- Metis Menu -->
    <script src="static/js/metisMenu.min.js"></script>
    <script src="static/js/custom.js"></script>
    <link href="static/css/custom.css" rel="stylesheet">
    <!--//Metis Menu -->

</head>
<body>
<div class="main-content">
    <!-- main content start-->
    <div id="page-wrapper">
        <div class="main-page login-page ">
            <h2 class="title1">登录</h2>
            <div class="widget-shadow">
                <div class="login-body">
                        <span id="msg" style="color: red"></span>
                        <input type="text" style="padding: 14px 15px 14px 37px;width: 100%;margin-bottom: 10px;"
                               class="user" id="username"  name="username" placeholder="登录账号" required="">
                        <input type="password" id="password" name="password" class="lock" placeholder="登录密码" required="">
                        <div class="forgot-grid">
                            <label class="checkbox">
                                <input type="checkbox" name="checkbox" checked=""><i></i>记住密码</label>
                            <div class="forgot">
                                <a href="#">忘记密码</a>
                            </div>
                            <div class="clearfix"></div>
                        </div>
                        <input type="submit" id="btn" value="登录">
                        <div class="registration">
                            还未注册
                            <a class="" href="signup.html">
                                点击注册
                            </a>
                        </div>
                </div>
            </div>
        </div>
    </div>
    <!--footer-->
    <div class="footer">
        <p>&copy; 2018 Glance Design Dashboard. All Rights Reserved | Design by
            <a href="https://w3layouts.com/" target="_blank">w3layouts</a></p>
    </div>
    <!--//footer-->
</div>

<!-- side nav js -->
<script src='static/js/SidebarNav.min.js' type='text/javascript'></script>
<script>
    $('.sidebar-menu').SidebarNav()
    $(function () {
        $("#btn").click(function () {
            let username = $("#username").val()
            let password = $("#password").val()
            let user =  new Object();
            user.username = username
            user.password = password
            $.ajax({
                url:'user/login',
                dataType:"json",
                data:user,
                type:"post",
                success:function (response) {
                    if(response){
                        location.href='to/home'
                    }else{
                        $("#msg").text('账号或密码错误')
                    }
                }
            })
        })
    })
</script>
<!-- //side nav js -->

<!-- Classie --><!-- for toggle left push menu script -->
<script src="static/js/classie.js"></script>
<script>
    var menuLeft = document.getElementById('cbp-spmenu-s1'),
        showLeftPush = document.getElementById('showLeftPush'),
        body = document.body;

    showLeftPush.onclick = function () {
        classie.toggle(this, 'active');
        classie.toggle(body, 'cbp-spmenu-push-toright');
        classie.toggle(menuLeft, 'cbp-spmenu-open');
        disableOther('showLeftPush');
    };

    function disableOther(button) {
        if (button !== 'showLeftPush') {
            classie.toggle(showLeftPush, 'disabled');
        }
    }
</script>
<!-- //Classie --><!-- //for toggle left push menu script -->

<!--scrolling js-->
<script src="static/js/jquery.nicescroll.js"></script>
<script src="static/js/scripts.js"></script>
<!--//scrolling js-->

<!-- Bootstrap Core JavaScript -->
<script src="static/js/bootstrap.js"></script>
<!-- //Bootstrap Core JavaScript -->

</body>
</html>